package com.zw.mes.module.system.controller;

import com.zw.mes.base.BaseController;
import com.zw.mes.common.JsonResult;
import com.zw.mes.module.system.service.UserService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description:
 *
 * @Author: China.sgl
 * @Date: 2020/7/30 9:42
 */
@Controller
@SuppressWarnings("all")
public class IndexController extends BaseController {

    @Autowired
    private UserService userService;

    @GetMapping("/index")
    public String index(Model model) {
        return "index";
    }

    /**
     * 修改密码
     *
     * @param pwd 新密码
     * @return json
     */
    @ResponseBody
    @PostMapping("/update/user/pwd")
    @RequiresAuthentication
    public JsonResult updatePwd(String pwd) {
        return isNotNull(userService.updateUserPassword(pwd));
    }

}
